/**
 * 2562. 找出数组的串联值
 */
public class No2562 {
    public long findTheArrayConcVal(int[] nums) {
        int n = nums.length;
        int left = 0, right = n - 1;

        long answer = 0;
        while (left <= right) {
            if (left != right) {
                answer += Integer.parseInt(String.valueOf(nums[left++]) + nums[right--]);
            } else answer += nums[left++];
        }
        return answer;
    }
}
